package com.example.interactivehouse;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;

public class FanScreen extends Activity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.fan);

		// final Animation animTranslate = AnimationUtils.loadAnimation(this,
		// R.anim.anim_translate);
		// final Animation animAlpha = AnimationUtils.loadAnimation(this,
		// R.anim.anim_alpha);
		// final Animation animScale = AnimationUtils.loadAnimation(this,
		// R.anim.anim_scale);
		final Animation animRotate = AnimationUtils.loadAnimation(this,
				R.anim.anim_rotate);

		// Button btnTranslate = (Button)findViewById(R.id.translate);
		// Button btnAlpha = (Button)findViewById(R.id.alpha);
		// Button btnScale = (Button)findViewById(R.id.scale);
		final Button btnRotate = (Button) findViewById(R.id.rotate);
		Button on = (Button) findViewById(R.id.fanon);
		Button off = (Button) findViewById(R.id.fanoff);
		final Button home = (Button) findViewById(R.id.homef);

		// btnTranslate.setOnClickListener(new Button.OnClickListener(){
		//
		// @Override
		// public void onClick(View arg0) {
		// arg0.startAnimation(animTranslate);
		// }});
		//
		// btnAlpha.setOnClickListener(new Button.OnClickListener(){
		//
		// @Override
		// public void onClick(View arg0) {
		// arg0.startAnimation(animAlpha);
		// }});
		//
		// btnScale.setOnClickListener(new Button.OnClickListener(){
		//
		// @Override
		// public void onClick(View arg0) {
		// arg0.startAnimation(animScale);
		// }});

		on.setOnClickListener(new Button.OnClickListener() {

			public void onClick(View arg0) {
				btnRotate.startAnimation(animRotate);
			}
		});
		off.setOnClickListener(new Button.OnClickListener() {

			public void onClick(View arg0) {
				btnRotate.clearAnimation();
			}
		});
		home.setOnClickListener(new OnClickListener() {
        	public void onClick(View v) { 
        		home.setBackgroundResource(R.drawable.hometap); 
        		Intent i = new Intent(FanScreen.this,InteraciveHouse.class);     
    			startActivity(i);
        	}        
        });
	}
}
